/*
 * @Author: your name
 * @Date: 2020-05-07 14:15:00
 * @LastEditTime: 2020-06-28 09:58:06
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \truck\platform\space_mgnt\file_space.h
 */
#ifndef _TINY_FILE_SPACE_H
#define _TINY_FILE_SPACE_H
#include <scsi/sg.h>
#include <linux/hdreg.h>


#define CONFIG_REC_DISK_NUM (100)

#define XSD_DISK_CAT_PATTERN_NUM	(8)

#define RAID_DEVICE		"/dev/md0"
#define PROC_PARTITIONS "/proc/partitions"
typedef enum xsd_disk_category_enum
{
	XSD_DISK_CAT_UNKNOWN,
	XSD_DISK_CAT_LOCAL=(1UL<<1),/*local SoC Host Controller or PCI Host Harddisk Controller*/
	XSD_DISK_CAT_USB=(1UL<<2),
	XSD_DISK_CAT_SD=(1UL<<3),
	//=========================================
}xsd_disk_cat_t;

enum XEREC_DISK_TYPE
{
	XEREC_DISK_TYPE_UNKNOWN=0,
	XEREC_DISK_TYPE_AUTO,
	XEREC_DISK_TYPE_HARDDISK,
	XEREC_DISK_TYPE_USBDISK,
	XEREC_DISK_TYPE_SDCARD,
};

#define XSD_HARDDISK_MAJOR	(8)
#define XSD_HARDDISK_MAJOR1	(65)
#define XSD_USBDISK_MAJOR	(8)
#define XSD_SDCARD_MAJOR	(179)





// #define CONFIG_XEREC_FILE_SIZE_AUTO_HARDDISK XEREC_SIZE_2GB
#define CONFIG_XEREC_FILE_SIZE_AUTO_HARDDISK (((long long)100)<<30)
typedef enum _XEREC_ERR
{
	/*-1*/XEREC_ERR=-1,/*general error*/
	/*-1*/XEREC_FAIL=-1,/*general fail*/
	XEREC_NORMAL=0,
	XEREC_SUCCESS=0,
}xeREC_ERR_t;

typedef struct xerec_disk_stru
{
	xeREC_ERR_t error;/*operation result*/

	char devname[64];/*RO*/
	char mntdir[64];/*RO*/
	char volume[64];

    long long capacity;//MB

    int type;
    int filesystem;
    int state;
    int status;

    int file_mode;

    struct xerec_disk_stru *next;
}xerec_disk_t;




int get_file_size_by_stat(const char *file_name,
    long long *file_size,long long *file_space);
int tiny_space_init();
int space_alloc_dir_for_new_device(t_space_query_info *p_path);
#endif//_TINY_FILE_SPACE_H